import * as apiService from '@/services/api';

/*
 * 获取举报记录列表
 * @param params
 * @returns {Promise<*>}
 *
 */
const getReportLogList = params => apiService.post(api.CHATROOM_REPORT_LIST, params);

/*
 * 获取举报类别
 * @param params
 * @returns {Promise<*>}
 *
 */
const getcate = () => apiService.post(api.CHATROOM_REPORT_TYPE);
/*
 * 新增类别
 * @param {number} uid 登录用户id
 * @param {string} account 登录用户name
 * @param {Array} name 禁言类别名称
 * @returns {Promise<*>}
 *
 */
const addCate = (params) => {
  const {
    uid, account, name,
  } = params;
  return apiService.post(api.CHATROOM_CATE_ADD, { uid, account, name });
};
/*
 * 获取禁言时长
 * @param params
 * @returns {Promise<*>}
 *
 */
const getBannedTime = () => apiService.post(api.CHATROOM_BANNED_TIME);

/*
 * 获取禁言用户列表
 * @param params
 * @returns {Promise<*>}
 *
 */
const getBannedUserList = params => apiService.post(api.CHATROOM_BANNED_USER_LIST, params);
/**
 * 获取待处理列表
 * @param params
 * @returns {Promise<*>}
 *
 */
const getPendingList = params => apiService.post(api.MEMBER_CHATROOM_PENDING_LIST, params);

/**
 * 用户举报详细
 * @param params
 * @returns {Promise<*>}
 *
 */
const getReportDetailList = params => apiService.post(api.MEMBER_CHATROOM_REPORT_DETAIL, params);
/**
 * 用户举报次数详细
 * @param params
 * @returns {Promise<*>}
 *
 */
const getReportNumDetailList = params => apiService.post(api.CHATROOM_REPORT_NUM_DETAIL, params);

/**
 * 获取待处理列表忽略操作
 * @param params
 * @returns {Promise<*>}
 *
 */
const postIgnoreReport = params => apiService.post(api.MEMBER_CHATROOM_PENDING_IGNORE, params);

/**
 * 获取待处理列表禁言操作
 * @param params
 * @returns {Promise<*>}
 *
 */
const getHistoryList = params => apiService.post(api.CHATROOM_HISTORY_LIST, params);


/*
 * 禁言操作
 * @param params
 * @returns {Promise<*>}
 *
 */
const postUserBan = params => apiService.post(api.MEMBER_CHATROOM_USER_BAN, params);
/*
 * 解禁操作
 * @param {number} uid 登录用户id
 * @param {string} account 登录用户name
 * @param {number} target_type
 *  @param {number} target_uid
 * @returns {Promise<*>}
 *
 */
const postUserUnBan = (params) => {
  const {
    uid, account, target_type, target_uid, remark, target_account, target_nick,
  } = params;
  return apiService.post(api.MEMBER_CHATROOM_USER_UNBAN, {
    uid, account, target_type, target_uid, remark, target_account, target_nick,
  });
};
/**
 * 获取禁言总投诉监控次数
 * @param params
 * @returns {Promise<*>}
 *
 */
const getReportSize = params => apiService.post(api.CHATROOM_REPORTSIZE_GET, params);
/*
 * 设置禁言总投诉监控次数
 * @param {integer} report_size 总投诉监控次数
 * @returns {Promise<*>}
 *
 */
const setReportSize = (params) => {
  const {
    report_size,
  } = params;
  return apiService.post(api.CHATROOM_REPORTSIZE_SET, { report_size });
};
/*
 * 设置禁言时间
 * @param {number} uid 登录用户id
 * @param {string} account 登录用户name
 * @param {Array} ttl[{value,unit}] 禁言时间，value秒数，unit: 0 永久，1分钟，2小时，3天
 * @returns {Promise<*>}
 *
 */
const setBanTime = (params) => {
  const {
    uid, account, ttl,
  } = params;
  return apiService.post(api.CHATROOM_REPORTTIME_SET, { uid, account, ttl }, 'contentTypeJson');
};
/*
 * 获取操作记录详细信息
 * @param {number} id 查询接口用户id
 * @returns {Promise<*>}
 *
 */
const getHistoryDetail = params => apiService.post(api.CHATROOM_HISTORY_detail, params);


export {
  getReportLogList,
  getcate,
  getBannedTime,
  getBannedUserList,
  addCate,
  getPendingList,
  getReportDetailList,
  postIgnoreReport,
  postUserBan,
  postUserUnBan,
  getReportSize,
  setReportSize,
  setBanTime,
  getHistoryList,
  getHistoryDetail,
  getReportNumDetailList,
};
